import type { RouterRecord } from "@/global/record/RouterRecord";

export const usePermissionStore = defineStore(
  'permission',
  () => {
    const cachedViews = ref<string[]>([]);

    function addCachedView(view: RouterRecord) {
      if (cachedViews.value.includes(view.name)) return
      if (!view.meta.noCache) {
        cachedViews.value.push(view.name)
      }
    }


    return {
      cachedViews,
      addCachedView,
    }
  }
)

